package main

import (
	"log"
	"net/url"
	"os"

	"gitee.com/kitfast/resml"
)

func main() {
	if len(os.Args) <= 1 {
		log.Fatalf("Usage: %s url", os.Args[0])
	}
	c := resml.NewUrlClient(nil)
	u, err := url.Parse(os.Args[1])
	if err != nil {
		log.Fatalf("url parse error: %s", err)
	}
	r := c.Get(u)
	m, err := r.Meta()
	if err != nil {
		log.Fatalf("get meta error: %s", err)
	}
	log.Printf("meta:\n%s", resml.MetaHttpHeaderText(m))
}
